//
//  ALMessageController.m
//  Ummy.G
//
//  Created by 安林 on 16/10/3.
//  Copyright © 2016年 安林. All rights reserved.
//

#import "ALMessageController.h"
#import "ALMessageTableViewCell.h"
#import "UIBarButtonItem+buttonItem.h"

@interface ALMessageController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,strong) UITableView * tableView;

//@property (nonatomic,strong) UIView * al;

@end

@implementation ALMessageController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tableView = [[UITableView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    
    //取消tableView的分割线
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

    [self.view addSubview:self.tableView];
    [self addRight];
    
}

#pragma mark  "添加左面的返回"
- (void)addRight{
    

    //------返回---------
    UIBarButtonItem *backR = [UIBarButtonItem barButtonItemWith:[UIButton buttonWithType:UIButtonTypeCustom] addTarget:self action:@selector(backRight) andImage:@"navigationButtonReturn" andHighlighted:nil];
    
    self.navigationItem.leftBarButtonItem =backR;
}



#pragma mark 返回多少行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}


#pragma mark 返回cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString * ID = @"Message";
    ALMessageTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [ALMessageTableViewCell loadALMessageTableViewCell];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}

#pragma mark 自定义cell的行高
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 80;
}

- (void)backRight{

    //没有push的时候用这个
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
